package com.orphan.supplier.service;

import com.orphan.supplier.po.RealSupplier;
import com.orphan.util.dto.SupplierFreezeDto;
import com.orphan.util.dto.SupplierInfoDto;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class MqClientService {
    @Autowired
    ISupplierService iSupplierService;
    //从MQ中取出供应商注册信息
    public static ArrayList<SupplierInfoDto> arrayList=new ArrayList<>();
    @RabbitListener(queues = "supplierInfoReturn")
    public void  getMessage(SupplierInfoDto supplierInfoDto){
        System.out.println(supplierInfoDto);
        arrayList.add(supplierInfoDto);
    }
//    @RabbitListener(queues = "supplierInfo")
//    public void  get(SupplierInfoDto supplierInfoDto){
//        System.out.println("hh"+supplierInfoDto);
//        arrayList.add(supplierInfoDto);
//        RealSupplier realSupplier = new RealSupplier();
//        realSupplier.setUsername(supplierInfoDto.getUsername());
//        realSupplier.setPassword(supplierInfoDto.getPassword());
//        realSupplier.setGender(supplierInfoDto.getGender());
//        realSupplier.setTel(supplierInfoDto.getTel());
//        realSupplier.setIdPic(supplierInfoDto.getIdPic());
//        realSupplier.setBrand(supplierInfoDto.getBrand());
//        realSupplier.setLicensePic(supplierInfoDto.getLicensePic());
//        realSupplier.setRanks(supplierInfoDto.getRank());
//        realSupplier.setStatus(supplierInfoDto.getStatus());
////        iSupplierService.insert(realSupplier);
//        System.out.println(iSupplierService.insert(realSupplier));
//    }
}
